Repository navigation
feat(MediaMtx): refactor runtime camera management - #1387
Conversation
Reviewer's GuideData structuresDefine the public camera and gateway option structures used by the service and its callers.
APISpecify the service operations and process-launcher contract that callers and the default implementation rely on.
ImplementationImplement on-demand gateway startup, readiness checks, process cleanup, and dynamic camera registration and removal.
Retain the existing process-launcher and HTTP-client helper implementations at their new package location.
ConfigurationMove the package into the components project tree and register the service without starting a hosted gateway automatically.
DocumentationUpdate the package README and bundled skill to explain the new on-demand service lifecycle and camera-management API.
Other changesFiles not grouped.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Linked issuesChecked at commit 9f2356d #1366 feat(MediaMtx): add runtime RTSP camera management · 5 of 6 met
|
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/components/BootstrapBlazor.MediaMtx/MediaMtxCameraOptions.cs" line_range="34" />
<code_context>
+ /// <para lang="en">Gets or sets the absolute RTSP or RTSPS URL with a host and without user information. Specify the port and stream path explicitly, and do not put credentials in the query string. For example: rtsp://192.168.1.100:554/Streaming/Channels/101</para>
+ /// <para><version>11.0.0</version></para>
+ /// </summary>
+ public string? RtspUrl { get; set; }
+
+ /// <summary>
</code_context>
<issue_to_address>
**Existing camera integrations break**
When an upgraded host retains `Url` in static camera configuration, an existing caller uses the former service contract, or a user follows the bundled HikVision skill, `MediaMtxCameraOptions` exposes `RtspUrl` instead of `Url`, so the skill no longer compiles and retained configuration leaves `RtspUrl` null; `BuildRtspSourceUrl` rejects that source, preventing registration. The changed `IMediaMtxService` return types also break existing callers and implementations at compile time and break already-built callers at runtime.
Restore a compatibility path for `Url` and the former service signatures, exposing the new behavior through additive APIs.
Also at `src/components/BootstrapBlazor.MediaMtx/IMediaMtxService.cs:34`, `src/components/BootstrapBlazor.MediaMtx/IMediaMtxService.cs:44`, `src/components/BootstrapBlazor.MediaMtx/IMediaMtxService.cs:54`.
</issue_to_address>
### Comment 2
<location path="src/components/BootstrapBlazor.MediaMtx/README.MediaMtx.md" line_range="82" />
<code_context>
+
+在已授权的 Interactive Server 页面使用播放器(引用 `BootstrapBlazor.HikVision`,它会依赖本包):
+
+```razor
+<HikVisionWebRtc Options="@camera" />
+
</code_context>
<issue_to_address>
**Documented player example fails**
When a consumer follows the README's HikVision player example, `HikVisionWebRtc` has no `Options` parameter and accepts `WebRtcUrl` instead, so the sample fails Razor compilation; the component also does not perform the described service startup or camera registration.
Update the example to use `WebRtcUrl` and revise the surrounding description to match the component's behavior.
Also at `src/components/BootstrapBlazor.MediaMtx/README.MediaMtx.md:83-95`, `src/components/BootstrapBlazor.MediaMtx/skills/bb-mediamtx/SKILL.md:36`.
</issue_to_address>
### Comment 3
<location path="src/components/BootstrapBlazor.MediaMtx/IMediaMtxService.cs" line_range="15" />
<code_context>
+/// <para lang="en">The default implementation throws <see cref="InvalidOperationException"/> for valid camera registration and deletion requests when the gateway is not running.</para>
+/// <para><version>11.0.0</version></para>
+/// </summary>
+public interface IMediaMtxService
+{
+ /// <summary>
</code_context>
<issue_to_address>
**Requested service interface**
The issue asks for an `IRtspService` exposing camera-path operations. The change provides those operations on `IMediaMtxService` instead, so consumers looking for the requested interface cannot use that API as specified.
</issue_to_address>
### Comment 4
<location path="src/components/BootstrapBlazor.MediaMtx/IMediaMtxService.cs" line_range="21" />
<code_context>
+ /// <para lang="zh">使用服务提供的配置启动 MediaMTX 进程。默认服务负责就绪探测和清理返回的进程。</para>
+ /// <para lang="en">Starts the MediaMTX process using the service-provided configuration. The default service probes readiness and cleans up the returned process.</para>
/// <para><version>11.0.0</version></para>
/// </summary>
/// <param name="startInfo"><para lang="zh">进程启动配置。</para><para lang="en">The process start configuration.</para></param>
</code_context>
<issue_to_address>
**Startup API shows the wrong release version**
The new `EnsureStartedAsync` API is marked as introduced in 11.0.0 even though the package project version is 11.0.1. Generated API documentation therefore reports it as available in the wrong release.
Mark `EnsureStartedAsync` with version 11.0.1.
</issue_to_address>| /// <para lang="en">Gets or sets the absolute RTSP or RTSPS URL with a host and without user information. Specify the port and stream path explicitly, and do not put credentials in the query string. For example: rtsp://192.168.1.100:554/Streaming/Channels/101</para> | ||
| /// <para><version>11.0.0</version></para> | ||
| /// </summary> | ||
| public string? RtspUrl { get; set; } |
There was a problem hiding this comment.
🟠 High · Existing camera integrations break
When an upgraded host retains Url in static camera configuration, an existing caller uses the former service contract, or a user follows the bundled HikVision skill, MediaMtxCameraOptions exposes RtspUrl instead of Url, so the skill no longer compiles and retained configuration leaves RtspUrl null; BuildRtspSourceUrl rejects that source, preventing registration. The changed IMediaMtxService return types also break existing callers and implementations at compile time and break already-built callers at runtime.
Restore a compatibility path for Url and the former service signatures, exposing the new behavior through additive APIs.
Also at src/components/BootstrapBlazor.MediaMtx/IMediaMtxService.cs:34, src/components/BootstrapBlazor.MediaMtx/IMediaMtxService.cs:44, src/components/BootstrapBlazor.MediaMtx/IMediaMtxService.cs:54.
Prompt for AI agents
In `src/components/BootstrapBlazor.MediaMtx/MediaMtxCameraOptions.cs` at line 34:
**Existing camera integrations break**
When an upgraded host retains `Url` in static camera configuration, an existing caller uses the former service contract, or a user follows the bundled HikVision skill, `MediaMtxCameraOptions` exposes `RtspUrl` instead of `Url`, so the skill no longer compiles and retained configuration leaves `RtspUrl` null; `BuildRtspSourceUrl` rejects that source, preventing registration. The changed `IMediaMtxService` return types also break existing callers and implementations at compile time and break already-built callers at runtime.
Restore a compatibility path for `Url` and the former service signatures, exposing the new behavior through additive APIs.
Also at `src/components/BootstrapBlazor.MediaMtx/IMediaMtxService.cs:34`, `src/components/BootstrapBlazor.MediaMtx/IMediaMtxService.cs:44`, `src/components/BootstrapBlazor.MediaMtx/IMediaMtxService.cs:54`.From AGENTS.md L18:
保留已有公开签名和接口约定。|
|
||
| 在已授权的 Interactive Server 页面使用播放器(引用 `BootstrapBlazor.HikVision`,它会依赖本包): | ||
|
|
||
| ```razor |
There was a problem hiding this comment.
🟠 High · Documented player example fails
When a consumer follows the README's HikVision player example, HikVisionWebRtc has no Options parameter and accepts WebRtcUrl instead, so the sample fails Razor compilation; the component also does not perform the described service startup or camera registration.
Update the example to use WebRtcUrl and revise the surrounding description to match the component's behavior.
Also at src/components/BootstrapBlazor.MediaMtx/README.MediaMtx.md:83-95, src/components/BootstrapBlazor.MediaMtx/skills/bb-mediamtx/SKILL.md:36.
Prompt for AI agents
In `src/components/BootstrapBlazor.MediaMtx/README.MediaMtx.md` at line 82:
**Documented player example fails**
When a consumer follows the README's HikVision player example, `HikVisionWebRtc` has no `Options` parameter and accepts `WebRtcUrl` instead, so the sample fails Razor compilation; the component also does not perform the described service startup or camera registration.
Update the example to use `WebRtcUrl` and revise the surrounding description to match the component's behavior.
Also at `src/components/BootstrapBlazor.MediaMtx/README.MediaMtx.md:83-95`, `src/components/BootstrapBlazor.MediaMtx/skills/bb-mediamtx/SKILL.md:36`.| /// <para lang="en">The default implementation throws <see cref="InvalidOperationException"/> for valid camera registration and deletion requests when the gateway is not running.</para> | ||
| /// <para><version>11.0.0</version></para> | ||
| /// </summary> | ||
| public interface IMediaMtxService |
There was a problem hiding this comment.
🟡 Medium · Requested service interface
The issue asks for an IRtspService exposing camera-path operations. The change provides those operations on IMediaMtxService instead, so consumers looking for the requested interface cannot use that API as specified.
Prompt for AI agents
In `src/components/BootstrapBlazor.MediaMtx/IMediaMtxService.cs` at line 15:
**Requested service interface**
The issue asks for an `IRtspService` exposing camera-path operations. The change provides those operations on `IMediaMtxService` instead, so consumers looking for the requested interface cannot use that API as specified.From #1366:
Expose a server-side IRtspService for adding, updating, and removing camera paths.| /// <para lang="zh">确保网关已启动并就绪,失败时抛出异常。默认实现复用本宿主的运行中进程;工具缺失时需手动部署。</para> | ||
| /// <para lang="en">Ensures the gateway is running and ready, throwing an exception on failure. The default service reuses its running process; missing tools must be deployed manually.</para> | ||
| /// <para><version>11.0.0</version></para> | ||
| /// </summary> |
There was a problem hiding this comment.
⚪ Low · Startup API shows the wrong release version
The new EnsureStartedAsync API is marked as introduced in 11.0.0 even though the package project version is 11.0.1. Generated API documentation therefore reports it as available in the wrong release.
Mark EnsureStartedAsync with version 11.0.1.
Prompt for AI agents
In `src/components/BootstrapBlazor.MediaMtx/IMediaMtxService.cs` at line 21:
**Startup API shows the wrong release version**
The new `EnsureStartedAsync` API is marked as introduced in 11.0.0 even though the package project version is 11.0.1. Generated API documentation therefore reports it as available in the wrong release.
Mark `EnsureStartedAsync` with version 11.0.1.From docs/agents/component-checklist.md L6:
- XML 注释遵循 [BB 组件规范](https://github.com/dotnetcore/BootstrapBlazor/blob/main/docs/agents/component-checklist.md#参数与-api)。新增 API 时标记其所属扩展包计划发布的正式版本;修改已有 API 时保留其引入版本。
Link issues
fixes #1366
Summary By Copilot
BootstrapBlazor.MediaMtxfromsrc/extensionstosrc/componentsand update the solution project reference.bb-mediamtxskill content.Regression?
This change is intended to reorganize the component package and refactor its implementation without changing the package name or registration entry point. Upgrade impact was not verified by a build or test run.
Risk
The package is moved to a new source location and its runtime gateway/service files are refactored, so project references, packaging, and runtime behavior require review.
Verification
No build or test was run. Read-only verification confirmed the working tree was clean, local and
origin/chore-mediamtxHEAD were9f2356de1e1484d61f147a8100b021814def58cf, and the branch containsmaster.Packaging changes reviewed?
Reviewed the solution reference, project move, package project file changes, README, and bundled skill packaging location.
☑️ Self Check before Merge
The README and bundled skill are updated; no demo was added. The branch is based on the latest
masterand does not require merging additional commit content.Summary by Sourcery
Move MediaMTX into the components package and make gateway and camera management available through an explicit on-demand service.
New Features:
Enhancements:
Build:
Documentation: